1. Field of the Invention
This invention relates to apparatus and method for cable length detection and signal compensation for a cable for transmitting analog signals.
2. Description of the Related Art
In a computer system, video signals are typically transmitted to a monitor from a video adapter via a cable. The video signals are degraded by the impedance matching of the cable. If the video signals are under-compensated due to cable loss, the images observed on the monitor may be blurred. On the other hand, if the video signals are over-compensated, over-excited signals may be formed, resulting in a reduction of monitor lifetime. Moreover, when the length of the cable exceeds ten meters, the video signals are considerably weakened, thus degrading the quality of images and may cause operation errors because of the unclear display. Specifically, various types of cables, such as a shielding twisted pair (STP), un-shielding twisted pair (UTP) and a foil twisted pair (FTP), have distinct frequency responses. The video signals therefore exhibit different attenuation phenomena when they are transmitted on various cables. The above reasons make it is difficult to use a simple signal compensation device in a fixed way to compensate for the signal attenuations occurring on cables of different types or different lengths.
In order to overcome the problems discussed above, methods are developed to measure the length of a cable and to compensate for signal attenuation based on measured cable length. Some systems use a time difference between transmission and return of high-speed streams to calculate the length of cable. In another system, described in commonly owned U.S. Patent Application Publication 2005/0227517, published Oct. 13, 2005, entitled “Cable length detection apparatus and method for a keyboarding video mouse switch,” a cable length detection apparatus is provided to detect the length of a cable having at least three pairs of wires for transmitting color video signals. In this system, shown in FIG. 1 (identical to FIG. 1 of the above reference commonly owned application), a signal compressing circuit 102 compresses an electrical signal into one of the three color signals of the video signal transmitted by the cable 104. A signal converting circuit 106 at the receiving end of the cable converts the electrical signal transmitted by the pair of wires into a value, and a length calculating circuit 108 calculates the length of the cable according to the value for subsequent use by signal compensation devices to compensate for signal attenuation caused by the cable 104. The cable 104 has at least three pairs of wires, which separately transmit three color signals contained in the video signal, such as a red color signal (R), a green color signal (G) and a blue color signal (B), or a luminance signal (Y) and two chrominance signals (U) and (V). In addition to three color signals, the video signal also includes a horizontal sync signal (H) and a vertical sync signal (V). The horizontal and vertical sync signals are compressed into two of the three color signals, and the electrical signal is compressed into the third color signal by the signal compressing circuit 102 when the vertical sync signal is enabled. A monitor typically does not display any video signals when the vertical sync signal is enabled. In other words, when the vertical sync signal is enabled, the electrical signal compressed into the third color signal does not form any images on the display, and therefore does not affect the users.
FIG. 2 (identical to FIG. 2 of the above reference commonly owned application) is a more detailed schematic diagram of the system in FIG. 1. As shown in FIG. 2, a video output device 212, such as a video card for computers, outputs video signals to a monitor 242 through a cable 204. The video signal comprises three RGB color signals, a horizontal sync signal and a vertical sync signal. The frequencies of the video signals can be up to 165 MHz. Signal attenuation of the video signals depend on the frequency response of the cable 204 and the frequencies of the video signals. In the system shown in FIG. 2, a square wave signal of 8 MHz is generated by an 8 MHz signal generator 214 for performing cable length measurement. When the vertical sync signal is enabled, the signal compressing circuit 210 compresses the 8 MHz square wave signal into the third color signal that is not used by the horizontal and vertical sync signals. The video signal is received by a signal receiving circuit 216 after being transmitted by the cable 204, and reconverted by a color recover circuit 222 into three color signals without sync signals and the square wave signals. A horizontal and vertical sync signals decode circuit 232 decodes the video signals from the signal receiving circuit 216 to obtain the horizontal sync signal and the vertical sync signal without the three color signals and the square wave signals, and an 8 MHz signal decode circuit 234 decodes the video signals from the signal receiving circuit 216 to obtain the 8 MHz square wave signal without the three color signals and the sync signals. The 8 MHz square wave signal transmitted by the cable 204 is converted into a value, such as a voltage, by an analog-to-digital (AD) converting circuit 206. Then, a central processing unit (CPU) 208 calculates the length of the cable 204 according the magnitude of the value, and a color compensation circuit 224 is used to compensate for the degraded color signals based on the value of cable length calculated. The horizontal sync signal, the vertical sync signal and the there compensated color signals are output to the monitor 242 through a video output port 240 for displaying the images which are substantially free of signal attenuation.